class Cache {
  setCache<T>(key: string, value: T) {
    localStorage.setItem(key, JSON.stringify(value))
  }
  getCache<T>(key: string): T | null {
    const value = localStorage.getItem(key)
    if (value) {
      return JSON.parse(value) as T
    }
    return null
  }
  removeCache(key: string) {
    localStorage.removeItem(key)
  }
  clearCache() {
    localStorage.clear()
  }
}
const localCache = new Cache()
export default localCache
